package org.come.Jpanel;

import com.tool.btn.FormsOnOffBtn;
import com.tool.btn.SummoningCompoundBtn;
import com.tool.btn.experimentCompoundBtn;
import com.tool.image.ImageMixDeal;
import com.tool.tcp.NewPart;
import com.tool.tcp.SpriteFactory;
import com.tool.tcpimg.RichLabel;
import com.tool.tcpimg.UIUtils;
import com.updateNew.MyIsif;

import org.come.Frame.TestpackJframe;
import org.come.Frame.ZhuFrame;
import org.come.bean.GoodsBean;
import org.come.bean.Skill;
import org.come.entity.Goodstable;
import org.come.model.ItemExchange;

import org.come.until.*;

import javax.swing.*;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.plaf.ScrollBarUI;
import javax.swing.plaf.basic.BasicTreeUI;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.TreePath;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

 

/**
 * 物品兑换
 * 
 * @author HGC<br>
 * @time 2020年1月10日 下午1:56:01<br>
 * @class 类名:SummoningCompoundJpanel<br>
 */
public class experimentCompoundJpanel extends JPanel {

	private Goodtype goodtype;
    /**
     * 字段名:labOne 第一个框<br>
     * 字段名:labTwo 第二个框<br>
     *
     * @time 2020年1月10日 下午2:09:54<br>
     */
    private JLabel labOne, labTwo,labThree,laba,labb,labc,labd;

    /**
     * 字段名:scpSummoningList 可召唤兽名单<br>
     * 字段名:scpSummoningInitialValue 初值属性<br>
     * 字段名:scpSummoningEndValue 天生技能<br>
     */
    private JScrollPane scpSummoningList, scpSummoningInitialValue, scpSummoningEndValue;
    private JTree jTreeSummoningList; // 套装列表
    private DefaultMutableTreeNode nodeSummoningList; // 总节点
    /**
     * 字段名:richInitialValue 初始属性<br>
     * 字段名:richEndValue 天生技能<br>
     */
    private RichLabel richInitialValue, richEndValue, richOneNum, richTwoNum,richa,richb,richc,richd;
    private BigDecimal money;
    private List<Goodstable> goodsList;
    private String valuest;
    /**
     * 字段名:petExchange 选中的召唤兽<br>
     */
    private ItemExchange ItemExchange;

    private experimentCompoundBtn btnCompound;

    private experimentCompoundJpanel.MLintener mlrOne, mlrTwo,mlrThree,mlra,mlrb,mlrc,mlrd;

    public experimentCompoundJpanel() {
        setPreferredSize(new Dimension(525, 408));
        setOpaque(false);
        setLayout(null);

        // 关闭按钮事件
        if(MyIsif.getStyle().equals("水墨UI")) {
        	FormsOnOffBtn offBtn = new FormsOnOffBtn("inkImg/old/2/1.png", 1, 700);
        	offBtn.setBounds(525 - 37, 10, 25, 25);
        	this.add(offBtn);
        }else {
        	FormsOnOffBtn offBtn = new FormsOnOffBtn("inkImg/hongmu/s74.png", 1, 700);
        	offBtn.setBounds(535 - 35, 0, 25, 25);
        	this.add(offBtn);
        }

        getRichTwoNum();
        getRichOneNum();
        getRicha();
        getRichb();
        getRichc();
        getRichd();

        getLabOne();
        getLabTwo();
        getLaba();
        getLabb();
        getLabc();
        getLabd();

        getLabThree();
        getScpSummoningList();
        getScpSummoningEndValue();
        getScpSummoningInitialValue();
        getBtnCompound();
    }

    /** 初始化召唤兽 */
    public void reSummoningList(Map<Integer, ItemExchange> map) {

        nodeSummoningList.removeAllChildren();
        // ConcurrentHashMap<Integer, petExchange> allPetExchange = new
        // ConcurrentHashMap<>();
        // if (map == null) {
        // map = new HashMap<Integer, petExchange>();
        // for (int i = 0; i < 100; i++) {
        // petExchange exchange = new petExchange();
        // exchange.seteId(i + 1);
        // exchange.setType(i % 4 == 0 ? "基本召唤兽" : (i % 3 == 0 ? "高级召唤兽" : (i %
        // 2 == 0 ? "顶级召唤兽" : "圣兽")));
        // exchange.setName("召唤兽" + i);
        // exchange.setHp(i * 5);
        // exchange.setMp(i * 2);
        // exchange.setSp(i * 3);
        // exchange.setGrow(0.2 * i);
        // exchange.setConsume("D=" + (1000 * i) + "|G=7050=" + (i * 3) + (i % 2
        // == 0 ? ("|G=101=" + i * 2) : ""));
        // exchange.setAp(i * 4);
        // exchange.setFive("金:" + (i * 2) + "木:" + (i * 5) + "水:" + (i * 8) +
        // "火:" + (i * 23) + "土:" + (i * 24));
        // exchange.setSkill("1075|1065|1005|1064");
        // map.put(exchange.geteId(), exchange);
        // allPetExchange.put(exchange.geteId(), exchange);
        // }
        // }
        // UserMessUntil.getAllPetExchange().setAllPetExchange(allPetExchange);
        List<ItemExchange> mapList = new ArrayList<>();
        Set<Entry<Integer, ItemExchange>> entrySet = map.entrySet();
        S: for (Entry<Integer, ItemExchange> entry : entrySet) {
            ItemExchange ItemExchange = entry.getValue();
            for (int i = 0; i < mapList.size(); i++) {
                if (mapList.get(i).geteId() > ItemExchange.geteId()) {
                    mapList.add(i, ItemExchange);
                    continue S;
                }
            }
            mapList.add(ItemExchange);
        }

        S: for (int i = 0; i < mapList.size(); i++) {
            ItemExchange ItemExchange = mapList.get(i);
            int childCount = nodeSummoningList.getChildCount();
            for (int j = 0; j < childCount; j++) {
                DefaultMutableTreeNode childAt = (DefaultMutableTreeNode) nodeSummoningList.getChildAt(j);
                if (ItemExchange.getType().equals(childAt.toString())) {
                    DefaultMutableTreeNode defaultMutableTreeNode = new DefaultMutableTreeNode(new JTreeData(
                            ItemExchange.getGoodsname(), String.valueOf(ItemExchange.geteId())));
                    childAt.add(defaultMutableTreeNode);
                    continue S;
                }
            }
            DefaultMutableTreeNode defaultMutableTreeNode = new DefaultMutableTreeNode(ItemExchange.getType());
            defaultMutableTreeNode.add(new DefaultMutableTreeNode(new JTreeData(ItemExchange.getGoodsname(), String
                    .valueOf(ItemExchange.geteId()))));
            nodeSummoningList.add(defaultMutableTreeNode);
        }
    }

    /** 展示初始数据 */
    public void ShowInitialValue(ItemExchange exchange) {

        StringBuffer buffer = new StringBuffer();
        if (exchange != null) {
//            buffer.append("成长率:");
            buffer.append(exchange.getInstruction());
            buffer.append("#r");

        }
        richInitialValue.setText(buffer.toString());
        Dimension d = richInitialValue.computeSize(105);
        richInitialValue.setSize(d);
        richInitialValue.setPreferredSize(d);
    }

    /** 展示天生技能 */
//    public void ShowEndValue(ItemExchange exchange) {
//        StringBuffer buffer = new StringBuffer();
//        if (exchange != null) {
//            String value = exchange.getValue();
//            valuest = value;
//            if (value != null && !"".equals(value)) {
//
//                String[] split = value.split("\\|");
//                for (int i = 0; i < split.length; i++) {
////                    Skill skillOne = UserMessUntil.getSkillId(split[i]);
//                    buffer.append(split[i]);
//                    buffer.append("#r");
//                    richEndValue.setText(buffer.toString());
//                    Dimension d = richEndValue.computeSize(105);
//                    richEndValue.setSize(d);
//                    richEndValue.setPreferredSize(d);
//                }
//                return;
//            }
//        }
//        richEndValue.setText(buffer.toString());
//        Dimension d = richEndValue.computeSize(123);
//        richEndValue.setSize(d);
//        richEndValue.setPreferredSize(d);
//
//    }

    /** 展示消耗物品金钱 */
    public void ShowConsume(ItemExchange exchange) {
        // D=消耗金钱|G=物品id=数量|G=物品id=数量
        clearConsume();
        if (exchange != null) {
            String consume = exchange.getConsume();
            if (consume != null && !"".equals(consume)) {
                String[] split = consume.split("\\|");
                int num = 0;
                for (int i = 0; i < split.length; i++) {
                    if (split[i].startsWith("D")) {
                        String[] arrMoney = split[i].split("=");
                        money = new BigDecimal(arrMoney[1]);
                    } else if (split[i].startsWith("G")) {
                        String[] arrMoney = split[i].split("=");
                        Goodstable goodstable = UserMessUntil.getgoodstable(new BigDecimal(arrMoney[1]));
                        int needMum = Integer.parseInt(arrMoney[2]);
                        if (num == 0) {
                            labOne.setIcon(GoodsListFromServerUntil.imgpathAdaptive(goodstable.getSkin(), 50, 50));
                            mlrOne.setGrid(goodstable.getGoodsid());
                            mlrOne.setNeedNum(needMum);
                            int goodNum = GoodsListFromServerUntil.getGoodNum(goodstable.getGoodsid());
                            if (needMum > goodNum) {
                                richOneNum.setText("#R" + goodNum + "#c228B22/" + needMum);
                            } else {
                                richOneNum.setText("#c228B22" + goodNum + "/" + needMum);
                            }
                        } else if (num == 1) {
                            labTwo.setIcon(GoodsListFromServerUntil.imgpathAdaptive(goodstable.getSkin(), 50, 50));
                            int goodNum = GoodsListFromServerUntil.getGoodNum(goodstable.getGoodsid());
                            mlrTwo.setGrid(goodstable.getGoodsid());
                            mlrTwo.setNeedNum(needMum);
                            if (needMum > goodNum) {
                                richTwoNum.setText("#R" + goodNum + "#c228B22/" + needMum);
                            } else {
                                richTwoNum.setText("#c228B22" + goodNum + "/" + needMum);
                            }
                        }
                        else if (num == 2) {
                            laba.setIcon(GoodsListFromServerUntil.imgpathAdaptive(goodstable.getSkin(), 50, 50));
                            int goodNum = GoodsListFromServerUntil.getGoodNum(goodstable.getGoodsid());
                            mlra.setGrid(goodstable.getGoodsid());
                            mlra.setNeedNum(needMum);
                            if (needMum > goodNum) {
                                richa.setText("#R" + goodNum + "#c228B22/" + needMum);
                            } else {
                                richa.setText("#c228B22" + goodNum + "/" + needMum);
                            }
                        }
                        else if (num == 3) {
                            labb.setIcon(GoodsListFromServerUntil.imgpathAdaptive(goodstable.getSkin(), 50, 50));
                            int goodNum = GoodsListFromServerUntil.getGoodNum(goodstable.getGoodsid());
                            mlrb.setGrid(goodstable.getGoodsid());
                            mlrb.setNeedNum(needMum);
                            if (needMum > goodNum) {
                                richb.setText("#R" + goodNum + "#c228B22/" + needMum);
                            } else {
                                richb.setText("#c228B22" + goodNum + "/" + needMum);
                            }
                        }
                        else if (num == 4) {
                            labc.setIcon(GoodsListFromServerUntil.imgpathAdaptive(goodstable.getSkin(), 50, 50));
                            int goodNum = GoodsListFromServerUntil.getGoodNum(goodstable.getGoodsid());
                            mlrc.setGrid(goodstable.getGoodsid());
                            mlrc.setNeedNum(needMum);
                            if (needMum > goodNum) {
                                richc.setText("#R" + goodNum + "#c228B22/" + needMum);
                            } else {
                                richc.setText("#c228B22" + goodNum + "/" + needMum);
                            }
                        }
                        else if (num == 5) {
                            labd.setIcon(GoodsListFromServerUntil.imgpathAdaptive(goodstable.getSkin(), 50, 50));
                            int goodNum = GoodsListFromServerUntil.getGoodNum(goodstable.getGoodsid());
                            mlrd.setGrid(goodstable.getGoodsid());
                            mlrd.setNeedNum(needMum);
                            if (needMum > goodNum) {
                                richd.setText("#R" + goodNum + "#c228B22/" + needMum);
                            } else {
                                richd.setText("#c228B22" + goodNum + "/" + needMum);
                            }
                        }

                        num++;
                    }
                }
            }
            labThree.setIcon(GoodsListFromServerUntil.imgpathAdaptive(exchange.getSkin(), 100, 100));
            int goodNum = GoodsListFromServerUntil.getGoodNum(exchange.getGoods());
            mlrThree.setGrid(exchange.getGoods());
            mlrThree.setNeedNum(exchange.geteId());
        }
    }

    /** 清空消耗物品金额 */
    public void clearConsume() {
        labOne.setIcon(null);
        labTwo.setIcon(null);
        labThree.setIcon(null);
        laba.setIcon(null);
        labb.setIcon(null);
        labc.setIcon(null);
        labd.setIcon(null);
        richOneNum.setText("");
        richa.setText("");        
        richb.setText("");
        richc.setText("");
        richd.setText("");        
        richTwoNum.setText("");


        mlrTwo.setGrid(null);
        mlrTwo.setNeedNum(0);
        mlrThree.setGrid(null);
        mlrThree.setNeedNum(0);
        mlrOne.setGrid(null);
        mlrOne.setNeedNum(0);
        mlra.setGrid(null);
        mlra.setNeedNum(0);
        mlrb.setGrid(null);
        mlrb.setNeedNum(0);
        mlrc.setGrid(null);
        mlrc.setNeedNum(0);
        mlrd.setGrid(null);
        mlrd.setNeedNum(0);
        money = null;
    }

    /** 物品移入移出监听 */
    class MLintener implements MouseListener {

        private BigDecimal grid;
        private int needNum;

        public MLintener(BigDecimal grid) {
            this.grid = grid;
        }

        @Override
        public void mouseClicked(MouseEvent e) {
            // TODO Auto-generated method stub

        }

        @Override
        public void mousePressed(MouseEvent e) {
            // TODO Auto-generated method stub

        }

        @Override
        public void mouseReleased(MouseEvent e) {
            // TODO Auto-generated method stub

        }

        @Override
        public void mouseEntered(MouseEvent e) {
            // TODO Auto-generated method stub
        	Goodstable goodstable = UserMessUntil.getgoodstable(grid);
            //判斷是否是装备
        	if(goodstable!=null) {
        		boolean b = Goodtype.ExerciseMonsterOre(goodstable.getType());
        		int xs = Goodtype.EquipmentType(goodstable.getType());
        		if(b==true || xs!=-1 || goodstable.getType() == 520 || goodstable.getType() == 190) {
        			goodstable.setValue(valuest);
        		}else {
        			goodstable.setValue(null);
        		}
        		if (goodstable != null) {
        			ZhuFrame.getZhuJpanel().creatgoodtext(goodstable);
        		}
        	}
        }

        @Override
        public void mouseExited(MouseEvent e) {
            TestpackJframe.getTestpackJframe().getJpac().ClearText();
            ZhuFrame.getZhuJpanel().cleargoodtext();
        }

        public BigDecimal getGrid() {
            return grid;
        }

        public void setGrid(BigDecimal grid) {
            this.grid = grid;
        }

        public int getNeedNum() {
            return needNum;
        }

        public void setNeedNum(int needNum) {
            this.needNum = needNum;
        }

    }

    private ImageIcon icon;

    private int oneNum, twoNum, num,a,b,c,d;

    @Override
    protected void paintComponent(Graphics g) {
        // TODO Auto-generated method stub
        super.paintComponent(g);
        if (icon == null) {
            if(MyIsif.getStyle().equals("水墨UI")) {
        		icon = new ImageIcon("inkImg/newbackground/B296.png");
        	}else {
        		icon = new ImageIcon("img/xy2uiimg/S16511.png");
        	}
        }
        g.drawImage(icon.getImage(), 0, 0, 525, 408, null);
        if(MyIsif.getStyle().equals("水墨UI")) {
        	Util.drawMoney(g, 396, 200);
        	if (money != null)
        		Util.drawPrice(g, money, 396, 174);
        }else {
        	Util.drawMoney(g, 410, 218);
        	if (money != null)
        		Util.drawPrice(g, money, 410, 189);
        }


        if (num > 100) {
            num = 0;
            if (mlrOne.getGrid() != null) {
                int goodNum = GoodsListFromServerUntil.getGoodNum(mlrOne.getGrid());
                if (goodNum != oneNum) {
                    oneNum = goodNum;
                    int needNum = mlrOne.getNeedNum();
                    if (needNum > goodNum) {
                        richOneNum.setText("#R" + goodNum + "#c228B22/" + needNum);
                    } else {
                        richOneNum.setText("#c228B22" + goodNum + "/" + needNum);
                    }
                }
            }
            if (mlrTwo.getGrid() != null) {
                int goodNum = GoodsListFromServerUntil.getGoodNum(mlrTwo.getGrid());
                if (goodNum != twoNum) {
                    twoNum = goodNum;
                    int needNum = mlrTwo.getNeedNum();
                    if (needNum > goodNum) {
                        richTwoNum.setText("#R" + goodNum + "#c228B22/" + needNum);
                    } else {
                        richTwoNum.setText("#c228B22" + goodNum + "/" + needNum);
                    }
                }
            }if (mlra.getGrid() != null) {
                int goodNum = GoodsListFromServerUntil.getGoodNum(mlra.getGrid());
                if (goodNum != a) {
                    a = goodNum;
                    int needNum = mlra.getNeedNum();
                    if (needNum > goodNum) {
                        richa.setText("#R" + goodNum + "#c228B22/" + needNum);
                    } else {
                        richa.setText("#c228B22" + goodNum + "/" + needNum);
                    }
                }
            }if (mlrb.getGrid() != null) {
                int goodNum = GoodsListFromServerUntil.getGoodNum(mlrTwo.getGrid());
                if (goodNum != b) {
                    b = goodNum;
                    int needNum = mlrb.getNeedNum();
                    if (needNum > goodNum) {
                        richb.setText("#R" + goodNum + "#c228B22/" + needNum);
                    } else {
                        richb.setText("#c228B22" + goodNum + "/" + needNum);
                    }
                }
            }if (mlrc.getGrid() != null) {
                int goodNum = GoodsListFromServerUntil.getGoodNum(mlrTwo.getGrid());
                if (goodNum != c) {
                    c = goodNum;
                    int needNum = mlrc.getNeedNum();
                    if (needNum > goodNum) {
                        richc.setText("#R" + goodNum + "#c228B22/" + needNum);
                    } else {
                        richc.setText("#c228B22" + goodNum + "/" + needNum);
                    }
                }
            }if (mlrd.getGrid() != null) {
                int goodNum = GoodsListFromServerUntil.getGoodNum(mlrd.getGrid());
                if (goodNum != d) {
                    d = goodNum;
                    int needNum = mlrd.getNeedNum();
                    if (needNum > goodNum) {
                        richd.setText("#R" + goodNum + "#c228B22/" + needNum);
                    } else {
                        richd.setText("#c228B22" + goodNum + "/" + needNum);
                    }
                }
            }
        }
        num++;
    }

    public JLabel getLabOne() {
        if (labOne == null) {
            labOne = new JLabel();
            if(MyIsif.getStyle().equals("水墨UI")) {
            	labOne.setBounds(230, 45, 50, 50);
            }else {
            	labOne.setBounds(230, 55, 50, 50);
            }
            mlrOne = new experimentCompoundJpanel.MLintener(null);
            labOne.addMouseListener(mlrOne);
            this.add(labOne);
        }
        return labOne;
    }

    public void setLabOne(JLabel labOne) {

        this.labOne = labOne;
    }

    public JLabel getLabTwo() {
        if (labTwo == null) {
            labTwo = new JLabel();
            if(MyIsif.getStyle().equals("水墨UI")) {
            	labTwo.setBounds(295, 45, 50, 50);
            }else {
            	labTwo.setBounds(295, 55, 50, 50);
            }
            mlrTwo = new experimentCompoundJpanel.MLintener(null);
            labTwo.addMouseListener(mlrTwo);
            this.add(labTwo);
        }
        return labTwo;
    }

    public void setLabThree(JLabel labThree) {
        this.labThree = labThree;
    }
    public JLabel getLabThree() {
        if (labThree == null) {
            labThree = new JLabel();
            if(MyIsif.getStyle().equals("水墨UI")) {
            	labThree.setBounds(382, 48, 100, 100);
            }else {
            	labThree.setBounds(382, 58, 100, 100);
            }
            mlrThree = new experimentCompoundJpanel.MLintener(null);
            labThree.addMouseListener(mlrThree);
            this.add(labThree);
        }
        return labThree;
    }

    public JLabel getLaba() {
        if (laba == null) {
            laba = new JLabel();
            if(MyIsif.getStyle().equals("水墨UI")) {
            	laba.setBounds(230, 105, 50, 50);
            }else {
            	laba.setBounds(230, 120, 50, 50);
            }
            mlra = new experimentCompoundJpanel.MLintener(null);
            laba.addMouseListener(mlra);
            this.add(laba);
        }
        return laba;
    }

    public void setLaba(JLabel laba) {
        this.laba = laba;
    }

    public JLabel getLabb() {
        if (labb == null) {
            labb = new JLabel();
            if(MyIsif.getStyle().equals("水墨UI")) {
            	labb.setBounds(295, 105, 50, 50);
            }else {
            	labb.setBounds(295, 120, 50, 50);
            }
            mlrb = new experimentCompoundJpanel.MLintener(null);
            labb.addMouseListener(mlrb);
            this.add(labb);
        }
        return labb;
    }

    public void setLabb(JLabel labb) {
        this.labb = labb;
    }

    public JLabel getLabc() {
        if (labc == null) {
            labc = new JLabel();
            if(MyIsif.getStyle().equals("水墨UI")) {
            	labc.setBounds(230, 163, 50, 50);
            }else {
            	labc.setBounds(230, 185, 50, 50);
            }
            mlrc = new experimentCompoundJpanel.MLintener(null);
            labc.addMouseListener(mlrc);
            this.add(labc);
        }
        return labc;
    }

    public void setLabc(JLabel labc) {
        this.labc = labc;
    }

    public JLabel getLabd() {
        if (labd == null) {
            labd = new JLabel();
            if(MyIsif.getStyle().equals("水墨UI")) {
            	labd.setBounds(295, 163, 50, 50);
            }else {
            	labd.setBounds(295, 185, 50, 50);
            }
            mlrd = new experimentCompoundJpanel.MLintener(null);
            labd.addMouseListener(mlrd);
            this.add(labd);
        }
        return labd;
    }

    public void setLabd(JLabel labd) {
        this.labd = labd;
    }

    public void setLabTwo(JLabel labTwo) {
        this.labTwo = labTwo;
    }

    public JScrollPane getScpSummoningList() {
    	if(MyIsif.getStyle().equals("水墨UI")) {
    		if (this.scpSummoningList == null) {
    			(this.scpSummoningList = new JScrollPane((Component)this.getjTreeSummoningList())).setVerticalScrollBarPolicy(22);
    			this.scpSummoningList.getVerticalScrollBar().setUI((ScrollBarUI)new ScrollUI());
    			this.scpSummoningList.getVerticalScrollBar().setUnitIncrement(20);
    			this.scpSummoningList.getViewport().setOpaque(false);
    			this.scpSummoningList.setOpaque(false);
    			this.scpSummoningList.setBounds(51, 52, 160, 333);
    			this.scpSummoningList.setBorder(BorderFactory.createEmptyBorder());
    			this.scpSummoningList.setHorizontalScrollBarPolicy(31);
    			this.add((Component)this.scpSummoningList);
    		}
    	}else {
    		if (this.scpSummoningList == null) {
    			(this.scpSummoningList = new JScrollPane((Component)this.getjTreeSummoningList())).setVerticalScrollBarPolicy(22);
    			this.scpSummoningList.getVerticalScrollBar().setUI((ScrollBarUI)new ScrollUI());
    			this.scpSummoningList.getVerticalScrollBar().setUnitIncrement(20);
    			this.scpSummoningList.getViewport().setOpaque(false);
    			this.scpSummoningList.setOpaque(false);
    			this.scpSummoningList.setBounds(25, 66, 178, 320);
    			this.scpSummoningList.setBorder(BorderFactory.createEmptyBorder());
    			this.scpSummoningList.setHorizontalScrollBarPolicy(31);
    			this.add((Component)this.scpSummoningList);
    		}
    	}
        return scpSummoningList;
    }

    public void setScpSummoningList(JScrollPane scpSummoningList) {
        this.scpSummoningList = scpSummoningList;
    }

    public JScrollPane getScpSummoningInitialValue() {
        if (this.scpSummoningInitialValue == null) {
            (this.scpSummoningInitialValue = new JScrollPane((Component)this.getRichInitialValue())).setVerticalScrollBarPolicy(22);
            this.scpSummoningInitialValue.getVerticalScrollBar().setUI((ScrollBarUI)new ScrollUI());
            this.scpSummoningInitialValue.getVerticalScrollBar().setUnitIncrement(20);
            this.scpSummoningInitialValue.getViewport().setOpaque(false);
            this.scpSummoningInitialValue.setOpaque(false);
            if(MyIsif.getStyle().equals("水墨UI")) {
            	this.scpSummoningInitialValue.setBounds(223, 266, 279, 118);
            }else {
            	this.scpSummoningInitialValue.setBounds(221, 276, 276, 115);
            }
            this.scpSummoningInitialValue.setBorder(BorderFactory.createEmptyBorder());//文字描述位置1
            this.scpSummoningInitialValue.setHorizontalScrollBarPolicy(31);
            this.add((Component)this.scpSummoningInitialValue);
        }
        return scpSummoningInitialValue;
    }

    public void setScpSummoningInitialValue(JScrollPane scpSummoningInitialValue) {
        this.scpSummoningInitialValue = scpSummoningInitialValue;
    }

    public JScrollPane getScpSummoningEndValue() {
        if (this.scpSummoningEndValue == null) {
            (this.scpSummoningEndValue = new JScrollPane((Component)this.getRichEndValue())).setVerticalScrollBarPolicy(22);
            this.scpSummoningEndValue.getVerticalScrollBar().setUI((ScrollBarUI)new ScrollUI());
            this.scpSummoningEndValue.getVerticalScrollBar().setUnitIncrement(20);
            this.scpSummoningEndValue.getViewport().setOpaque(false);
            this.scpSummoningEndValue.setOpaque(false);
            this.scpSummoningEndValue.setBounds(376, 277, 121, 115);
            this.scpSummoningEndValue.setBorder(BorderFactory.createEmptyBorder());
            this.scpSummoningEndValue.setHorizontalScrollBarPolicy(31);
//            this.add((Component)this.scpSummoningEndValue);
        }
        return scpSummoningEndValue;
    }

    public void setScpSummoningEndValue(JScrollPane scpSummoningEndValue) {
        this.scpSummoningEndValue = scpSummoningEndValue;
    }

    public ImageIcon getIcon() {
        return icon;
    }

    public void setIcon(ImageIcon icon) {
        this.icon = icon;
    }

    public JTree getjTreeSummoningList() {
        if (jTreeSummoningList == null) {
            jTreeSummoningList = new JTree(getNodeSummoningList());
            jTreeSummoningList.setOpaque(false);
            jTreeSummoningList.putClientProperty("JTree.lineStyle", "None"); // 去除jtree的线条
            ((BasicTreeUI) jTreeSummoningList.getUI()).setLeftChildIndent(0); // 设置父节点与子节点左对齐，并去除缩进
            DefaultTreeCellRenderer cellRenderer = new DefaultTreeCellRenderer() {
                @Override
                public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected,
                                                              boolean expanded, boolean leaf, int row, boolean hasFocus) {
                    DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
                    super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);

                    // 判断是几级的叶子
                    if (node.getLevel() == 2) {
                        JTreeData jtd = (JTreeData) node.getUserObject();
                        setText(jtd.getString());
                    }
                    return this;
                }
            };
            cellRenderer.setLeafIcon(null); // 设置叶子图标
            try {
                cellRenderer.setOpenIcon(null);// 设置打开子节点图标
                cellRenderer.setClosedIcon(null); // 设置关闭子节点图标
            } catch (Exception e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }

            cellRenderer.setFont(UIUtils.TEXT_FONT1);// 设置字体.
            cellRenderer.setBackgroundNonSelectionColor(UIUtils.Color_BACK);// 设置非选定节点的背景色
            cellRenderer.setBackgroundSelectionColor(new Color(99, 93, 90));// 设置节点在选中状态下的背景色
            cellRenderer.setBorderSelectionColor(UIUtils.Color_BACK);// 设置选中状态下节点边框的颜色

            /*
             * 设置选时或不选时，文字的变化颜色
             */
            cellRenderer.setTextNonSelectionColor(Color.white);// 设置绘制未选中状态下节点文本的颜色
            cellRenderer.setTextSelectionColor(Color.white);// 设置绘制选中状态下节点文本的颜色
            jTreeSummoningList.setCellRenderer(cellRenderer);
            jTreeSummoningList.setRootVisible(false); // 隐藏根节点
            jTreeSummoningList.setRowHeight(20); // 设置节点行高
            // 单击展开子节点
            jTreeSummoningList.addMouseListener(new MouseAdapter() { // 添加鼠标事件处理
                @Override
                public void mousePressed(MouseEvent e) {
                    if (SwingUtilities.isLeftMouseButton(e)) { // 点击了鼠标左键
                        TreePath path = jTreeSummoningList.getSelectionPath();
                        if (path != null) {
                            if (jTreeSummoningList.isExpanded(path)) {
                                jTreeSummoningList.collapsePath(path);// 关闭节点
                            } else {
                                jTreeSummoningList.expandPath(path);// 展开节点
                            }
                        }
                    }
                }
            });
            jTreeSummoningList.addTreeSelectionListener(new TreeSelectionListener() {

                @Override
                public void valueChanged(TreeSelectionEvent e) {

                    JTree tree = (JTree) e.getSource();
                    // 利用JTree的getLastSelectedPathComponent()方法取得目前选取的节点.
                    DefaultMutableTreeNode selectionNode = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
                    if (selectionNode == null) {
                        scpSummoningList.setViewportView(null);
                        return;
                    }
                    String nodeName = selectionNode.toString();
                    if (selectionNode.isLeaf()) {// 判断是否是叶子节点
                        JTreeData treeData = (JTreeData) selectionNode.getUserObject();
                        int parseInt = Integer.parseInt(treeData.getPath());
                        ItemExchange exchange = UserMessUntil.getItemExchange(parseInt);
                        ItemExchange = exchange;
                        valuest = exchange.getValue();


//                        int goodNum = GoodsListFromServerUntil.getGoodNum(goodstable.getGoodsid());
//                        if (needMum > goodNum) {
//                            richOneNum.setText("#R" + goodNum + "#c228B22/" + needMum);
//                        } else {
//                            richOneNum.setText("#c228B22" + goodNum + "/" + needMum);
//                        }
//                        part = SpriteFactory.createPart(exchange.getSkin(), 7, 1, null);
                        ShowInitialValue(exchange);
//                        ShowEndValue(exchange);
                        ShowConsume(exchange);
                    } else {
                    }
                }
            });
        }
        return jTreeSummoningList;
    }

    public void setjTreeSummoningList(JTree jTreeSummoningList) {
        this.jTreeSummoningList = jTreeSummoningList;
    }

    public DefaultMutableTreeNode getNodeSummoningList() {
        if (nodeSummoningList == null) {
            nodeSummoningList = new DefaultMutableTreeNode("");
            reSummoningList(UserMessUntil.getAllItemExchange().getAllItemExchange());
        }
        return nodeSummoningList;
    }

    public void setNodeSummoningList(DefaultMutableTreeNode nodeSummoningList) {
        this.nodeSummoningList = nodeSummoningList;
    }

    public RichLabel getRichInitialValue() {
        if (richInitialValue == null) {
            richInitialValue = new RichLabel();
        }
        return richInitialValue;
    } 

    public void setRichInitialValue(RichLabel richInitialValue) {
        this.richInitialValue = richInitialValue;
    }

    public RichLabel getRichEndValue() {
        if (richEndValue == null) {
            richEndValue = new RichLabel();
        }
        return richEndValue;
    }

    public void setRichEndValue(RichLabel richEndValue) {
        this.richEndValue = richEndValue;
    }
//已经调整坐标
    public RichLabel getRichOneNum() {
        if (richOneNum == null) {
            richOneNum = new RichLabel();
            if(MyIsif.getStyle().equals("水墨UI")) {
            	richOneNum.setBounds(235, 82, 50, 16);
            }else {
            	richOneNum.setBounds(235, 92, 50, 16);
            }
            this.add(richOneNum);
        }
        return richOneNum;
    }

    public void setRichOneNum(RichLabel richOneNum) {
        this.richOneNum = richOneNum;
    }

    public RichLabel getRichTwoNum() {
        if (richTwoNum == null) {
            richTwoNum = new RichLabel();
            if(MyIsif.getStyle().equals("水墨UI")) {
            	richTwoNum.setBounds(300, 82, 50, 16);
            }else {
            	richTwoNum.setBounds(300, 92, 50, 16);
            }
            this.add(richTwoNum);
        }
        return richTwoNum;
    }

    public RichLabel getRicha() {
        if (richa == null) {
            richa = new RichLabel();
            if(MyIsif.getStyle().equals("水墨UI")) {
            	richa.setBounds(235, 145, 50, 16);
            }else {
            	richa.setBounds(235, 157, 50, 16);
            }
            this.add(richa);
        }
        return richa;
    }

    public void setRicha(RichLabel richa) {
        this.richa = richa;
    }

    public RichLabel getRichb() {
        if (richb == null) {
            richb = new RichLabel();
            if(MyIsif.getStyle().equals("水墨UI")) {
            	richb.setBounds(300, 145, 50, 16);
            }else {
            	richb.setBounds(300, 157, 50, 16);
            }
            this.add(richb);
        }
        return richb;

    }

    public void setRichb(RichLabel richb) {
        this.richb = richb;
    }

    public RichLabel getRichc() {
        if (richc == null) {
            richc = new RichLabel();
            if(MyIsif.getStyle().equals("水墨UI")) {
            	richc.setBounds(235, 202, 50, 16);
            }else {
            	richc.setBounds(235, 222, 50, 16);
            }
            this.add(richc);
        }
        return richc;

    }

    public void setRichc(RichLabel richc) {
        this.richc = richc;
    }

    public RichLabel getRichd() {
        if (richd == null) {
            richd = new RichLabel();
            if(MyIsif.getStyle().equals("水墨UI")) {
            	richd.setBounds(300, 202, 50, 16);
            }else {
            	richd.setBounds(300, 222, 50, 16);
            }
            this.add(richd);
        }
        return richd;

    }

    public void setRichd(RichLabel richd) {
        this.richd = richd;
    }

    public void setRichTwoNum(RichLabel richTwoNum) {
        this.richTwoNum = richTwoNum;
    }

    public BigDecimal getMoney() {
        return money;
    }

    public void setMoney(BigDecimal money) {
        this.money = money;
    }

    public List<Goodstable> getGoodsList() {
        return goodsList;
    }

    public void setGoodsList(List<Goodstable> goodsList) {
        this.goodsList = goodsList;
    }
//
//    public NewPart getPart() {
//        return part;
//    }
//
//    public void setPart(NewPart part) {
//        this.part = part;
//    }

    public ItemExchange getItemExchange() {
        return ItemExchange;
    }

    public void setItemExchange(ItemExchange ItemExchange) {
        this.ItemExchange = ItemExchange;
    }

    public experimentCompoundBtn getBtnCompound() {
        if(MyIsif.getStyle().equals("水墨UI")) {
    		if (btnCompound == null) {
    			btnCompound = new experimentCompoundBtn("skin/8100226/newbutton/B20.png", 1, UIUtils.COLOR_BLACK, "兑换",
    					UIUtils.TEXT_HY16, 1, this);
    			btnCompound.setBounds(400, 205, 59, 24);
    			this.add(btnCompound);
    		}
        }else {
            if (btnCompound == null) {
                btnCompound = new experimentCompoundBtn("inkImg/hongmu/6026.png", 1, UIUtils.COLOR_BTNPUTONG2, "兑换",
                        UIUtils.TEXT_HY16, 1, this);
                btnCompound.setBounds(422, 230, 60, 26);
                this.add(btnCompound);
            }
        }
        return btnCompound;
    }
    
    
    

    public void setBtnCompound(experimentCompoundBtn btnCompound) {
        this.btnCompound = btnCompound;
    }

}
